# coding=UTF-8
'''
Created on 2018年4月27日

@author: lijie
'''
from businessLayer.page_element.element_base import ElementBase

class LblTitle(ElementBase):
    '''新增采集弹出页面标题
    '''
    def __init__(self,dr):
        self.dr=dr
        ElementBase(self.dr,"//span[.='新增']")

class TxtCollectionTaskNAME(ElementBase):
    '''采集任务名称
    '''
    def __init__(self,dr):
        self.dr=dr
        ElementBase(self.dr,"//label[contains(.,'采集任务名称')]/following-sibling::div//input")
        
class LstBtnMetaModel(ElementBase):
    '''元模型下拉按钮
    '''
    def __init__(self,dr):
        self.dr=dr
        ElementBase(self.dr,"//label[contains(.,'元模型')]/following-sibling::div//span[@class='el-cascader__label']")
        
class Lst1MetaModel(ElementBase):
    '''元模型一级菜单
    '''
    def __init__(self,dr):
        self.dr=dr
        ElementBase(self.dr,"//div[not(contains(@style,'display: none')) and @class='el-cascader-menus el-popper']//ul")
        
class Lst2MetaModel(ElementBase):
    '''元模型二级菜单
    '''
    def __init__(self,dr):
        self.dr=dr
        ElementBase(self.dr,"//div[not(contains(@style,'display: none')) and @class='el-cascader-menus el-popper']//ul/following-sibling::ul")
        
class Lst3MetaModel(ElementBase):
    '''元模型三级菜单
    '''
    def __init__(self,dr):
        self.dr=dr
        ElementBase(self.dr,"//div[not(contains(@style,'display: none')) and @class='el-cascader-menus el-popper']//ul/following-sibling::ul/following-sibling::ul")
        
class LstBtnDataSource(ElementBase):
    '''数据源名称下拉按钮
    '''
    def __init__(self,dr):
        self.dr=dr
        ElementBase(self.dr,"//label[contains(.,'数据源名称')]/following-sibling::div//span")
        
class LstDataSource(ElementBase):
    '''数据源名称下拉菜单
    '''
    def __init__(self,dr):
        self.dr=dr
        ElementBase(self.dr,"//div[not(contains(@style,'display: none')) and @class='el-select-dropdown el-popper']//ul")   
        
class LstBtnDirectory(ElementBase):
    '''挂载目录下拉按钮
    '''
    def __init__(self,dr):
        self.dr=dr
        ElementBase(self.dr,"//label[contains(.,'挂载目录')]/following-sibling::div//span")
        
class LstDirectory(ElementBase):
    '''挂载目录下拉菜单
    '''
    def __init__(self,dr):
        self.dr=dr
        ElementBase(self.dr,"//div[not(contains(@style,'display: none')) and @class='el-cascader-menus el-popper']//ul")  
        
class RadSchedulmodeByName(ElementBase):
    '''调度方式单选框
    '''
    def __init__(self,dr,name):
        self.dr=dr
        ElementBase(self.dr,"//label[contains(.,'调度方式')]/following-sibling::div//span[.='"+name+"']/parent::label//span[@class='el-radio__inner']")
        
class LnkRecommendTime(ElementBase):
    '''推荐最优调度时间链接
    '''
    def __init__(self,dr):
        self.dr=dr
        ElementBase(self.dr,"//a[.='换一个']")

# 周期性采集频率下拉框元素定位         
# class LstBtnCollFreq(ElementBase):
#     '''周期性采集频率方式选择下拉按钮
#     '''
#     def __init__(self,dr):
#         self.dr=dr
#         ElementBase(self.dr,"//i[@class='el-select__caret el-input__icon el-icon-arrow-up is-reverse']")
class LstBtnsFreq(ElementBase):
    '''周期性采集频率选择下拉按钮集
    '''
    def __init__(self,dr):
        self.dr=dr
        ElementBase(self.dr,"//label[contains(.,'采集频率')]/following-sibling::div//i[@class='el-select__caret el-input__icon el-icon-arrow-up']") 

class LstCollFreq(ElementBase):
    '''周期性采集频率方式选择下拉菜单
    '''
    def __init__(self,dr):
        self.dr=dr
        ElementBase(self.dr,"//div[not(contains(@style,'display: none')) and @class='el-select-dropdown el-popper']//ul")    
        
class LstFrequecy(ElementBase):
    '''周期性采集频选择下拉菜单，
        注意：每个下拉菜单都用该类方法定位，同一时刻只会有一个下拉菜单可见
    '''
    def __init__(self,dr):
        self.dr=dr
        ElementBase(self.dr,"//div[not(contains(@style,'display: none')) and @class='el-select-dropdown el-popper is-multiple']//ul")   
        
class BtnSubmit(ElementBase):
    def __init__(self,dr):
        self.dr=dr
        ElementBase(self.dr,"//button[.='提交']") 
        
class BtnCancel(ElementBase):
    def __init__(self,dr):
        self.dr=dr
        ElementBase(self.dr,"//button[.='取消']") 
        